export function getlogin(){
	let ss = {}
	let islogin= false;
	uni.getStorage({
	    key: 'user',
	    success: function (res) {
			ss =res.data;
			if(ss!=null){
				islogin=true;
			}
	    }
	});
	ss.islogin = islogin;
	return ss;
}
/*
 *数字用单位数用逗号隔开
 * s数字字符串
 * n数字保留几位
 */

export function fmoney(s, n) {  
    n = n > 0 && n <= 20 ? n : 2; 

    s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";  
    var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1];  
    var t = "";  
    for (var i = 0; i < l.length; i++) {  
        t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");  
    }  
    return t.split("").reverse().join("") + "." + r;  
}  
export function timestampToDate(timestamp) {
	var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
	var Y = date.getFullYear() + '年';
	var M = (date.getMonth()+1)+'月';
	var D = date.getDate() + '日';
	return Y+M+D;
}
export function timestampToDate1(timestamp) {
	var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
	var Y = date.getFullYear() + '-';
	var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
	var D = date.getDate() + ' ';
	return Y+M+D;
}
export function timestampToDate2(timestamp) {
	var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
	var Y = date.getFullYear() + '-';
	var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
	var D = date.getDate() + ' ';
	var h = date.getHours() + ':';
	var m = date.getMinutes() ;
	if(m>=0&&m<10){
		m="0"+m;
	}
//var s = date.getSeconds();
	return Y+M+D+h+m;
}